using System.Collections;
using System.Collections.Generic;
public class Buff2 : PlayerControllerBuffBase
{
    private readonly float m_NegativeMultiplier = 0.5f;
    private readonly float m_PositiveMultiplier = 0.5f;

    #region Public方法

    #endregion

    #region Private方法
    public override string GetDescription()
    {
        return $"使你受到的正面buff的持续时间增加{m_PositiveMultiplier * 100}%，\n" +
            $"负面buff的持续时间降低{m_NegativeMultiplier * 100}%。";
    }

    public override void AfterBeAdded()
    {
        Owner.BuffSystem.OnAddBuff += OnAddBuffListener;
    }

    public override void AfterBeRemoved()
    {
        Owner.BuffSystem.OnAddBuff -= OnAddBuffListener;
    }

    private void OnAddBuffListener(BuffBase<PlayerController> buff)
    {
        if (buff.BuffData.isPermanent)
        {
            return;
        }
        if (buff.BuffData.buffType == BuffType.Negative)
        {
            buff.DurationScale -= m_NegativeMultiplier;
        }
        else if (buff.BuffData.buffType == BuffType.Positive)
        {
            buff.DurationScale += m_PositiveMultiplier;
        }
    }


    #endregion
}